home *** CD-ROM | disk | FTP | other *** search
/ Rhapsody 4 #2 / Rhapsody 4 - Issue 2.iso / !InstallR4 / DATA / 099 < prev    next >
Text File  |  2000-02-26  |  44KB  |  1,321 lines

  1.  
  2.      Rhapsody4 Data Structure
  3.      ~~~~~~~~~~~~~~~~~~~~~~~~
  4.      
  5.      Rhapsody 4 files differ from earlier versions in the following
  6. major ways.
  7.  
  8.    * They are fully word aligned
  9.    * They use lettered identifiers to make slots and data more easily
  10. recognizable
  11.    * Block lengths are now allocated two bytes. Data lengths are now
  12. allocated one whole byte. This means that there are effectively no
  13. restrictions on the number of notes in a slot or the length of data
  14. items
  15.    * A large number of restrictions have been removed
  16.    
  17.    
  18.       Overall structure
  19.       ~~~~~~~~~~~~~~~~~
  20.       
  21.       &50414852    RHAP
  22.       &59444F53    SODY
  23.       &30302E34    4.00 
  24.       &0000000D    <CR>
  25.       
  26.       &xxxxxxxx    Block type
  27.       &ffffllll    Block flags and length
  28.       
  29.       &2A2A2A2A    ****
  30.       
  31.       
  32.       Block types
  33.       ~~~~~~~~~~~
  34.       
  35.       **SC     43532A2A   contains data about the whole score
  36.       **ST     54532A2A   contains data about a particular stave
  37.       **SY     59532A2A   contains data about a system (ie a line)
  38.       **HD     44482A2A   contains data about the titles
  39.       **SL     4C532A2A   contains data about a data slot
  40.       **EX     58452A2A   contains exclusive data
  41.         
  42.       Every Rhapsody file must start with a **SC block followed by the
  43. correct number of **ST blocks. Next comes at least one **SY block and
  44. the **HD block. These are followed by any number of **SL blocks
  45. interspersed with (optional) **SY blocks.
  46.  
  47.       All current and future versions of Rhapsody ignore **EX blocks.
  48.       
  49.       Every file must end with ****.
  50.  
  51.  
  52.       The **SC block
  53.       ~~~~~~~~~~~~~~
  54.  
  55. 0     &43532A2A        **SC 
  56. 4     &ffffllll        flags and length                   see note 1
  57.  
  58. 8     4*10             offset to start of font list
  59. 12    nstaves          number of staves  
  60. 16    playopt          play options                      see note 1a 
  61. 20    speed            playing speed                     see note 1b 
  62. 24    midibeat         MIDI beat channel and pitch       see note 1c
  63. 28    printopt         print options                     see note 1e
  64. 32    score length     in bytes
  65. 36    score width      total width of all slots in OS units 
  66. 40    midibeatdata     MIDI beat pc data                 see note 1d
  67. 44    initial          initial bar and page numbers etc. see note 1f
  68.  
  69.       4*(n+1)          offset to end of body text font
  70. n     copyright        font family                   (CR terminated)
  71.       4*(n+1)          offset to end of alternative text
  72. n     copyright        font family                   (CR terminated)
  73.       4*(n+1)          offset to end of copyright notice
  74. n     copyright        copyright notice              (CR terminated)
  75.  
  76.  
  77. Notes
  78. ~~~~~
  79.  
  80. 1.    Flags            bit 31 set - this score has been created by
  81.                        Rhapsody4 and does not need resetting
  82.                        bit 30 set - all data code lengths have been
  83.                        changed from bytes to words
  84.                        bit 29 set - this score begins with an
  85.                        annacrusis bar
  86.                        
  87.  
  88. 1a.   Play options              (1 word)
  89.  
  90.       bits    if set...
  91.  
  92.       0       MIDI flag         (play MIDI)
  93.       1       speaker flag      (play speaker)
  94.       2       scroll flag       (scroll window while playing)
  95.       3                         (not used)
  96.       4       repeat            (play all repeats)
  97.       5       speaker beat flag (play beat through speaker)
  98.       6       MIDI beat flag    (play beat through MIDI)
  99.       7       MIDI clock        (transmit MIDI clock signals)
  100.       8       swing flag        (if set, swing rythm)
  101.       9-15                      (not used)
  102.       16-23   randomise         0 to 100
  103.       24-31   expression        -100 to 100
  104.  
  105.  
  106. 1b.   Speed                     (1 word)
  107.      
  108.       100 = normal speed
  109.  
  110.      
  111. 1c.   MIDI beat channel and pitch    
  112.  
  113.       bits
  114.  
  115.       0-3     MIDI beat channel  (default value 9 (ie channel 10))
  116.       4-7     unused
  117.       8-15    pitch: 60 = middle C    (default value 37)
  118.       16-27   unused
  119.       28-31   MIDI beat port  (default vaue 0 (ie port 1))
  120.  
  121. 1d.   MIDI beat data                           (default &40000000)
  122.      
  123.       bits                                              default
  124.  
  125.       0-7     MIDI program number+1 (0-128) 0 = don't send    0
  126.       8-15    bank number LSB+1 (0-128)     0 = don't send    0
  127.       16-23   bank number MSB+1 (0-128)     0 = don't send    0
  128.       24-30   MIDI stereo position (0-127)                   64
  129.       31      not used (must be zero)
  130.      
  131. 1e.   Print options             (1 word)
  132.  
  133.       bits
  134.      
  135.       0       0 = 4/4                   1 = C  (common time)
  136.       1       0 = 2/2                   1 = C' (alla breve)
  137.       2       0 = triplets with gap     1 = triplets without gap
  138.       3       0 = bracket all triplets  1 = unbeamed triplets only
  139.       4       0 = offset heads          1 = share heads
  140.       5       0 = back to back          1 = interlock heads
  141.       6       0 = pedal lines           1 = pedal sprites
  142.       7       0 = rehearsal letters     1 = rehearsal numbers
  143.       8       0 = don't count           1 = count 1st time bars
  144.       9       0 = no slash              1 = slash between systems
  145.       10      0 = normal time sigs      1 = time sigs above stave
  146.       11      0 = normal clefs          1 = old clefs
  147.       12      1 = show guitar chord names
  148.       13      1 = show tablature
  149.       14      1 = pedal sprites with dashed lines
  150.      
  151. 1f.   Initial numbers           (1 word)
  152.       
  153.       0-7     not used
  154.       8-15    initial rehearsal letter
  155.       16-23   initial bar number
  156.       24-31   initial page number
  157.  
  158.       
  159.  
  160.       The **ST block
  161.       ~~~~~~~~~~~~~~
  162.       
  163. 0     &54532A2A        **ST
  164. 4     &ffffllll        length
  165.  
  166. 8     4*4(+128)        offset to end of stave data
  167. 12    stavedata1       stave data                         see note 2a
  168. 16    stavedata2       stave data                         see note 2b
  169. 20    stavedata3       stave data                         see note 2c
  170.  
  171. (24                    optional pitchmap                  see note 2d)
  172.  
  173. 1     4*(1+m)          offset to end of stave name
  174. m     stname           stave name         (var length, CR terminated)
  175.  
  176. 1     4*(1+n)          offset to end of stave abbreviation
  177. n     stabbrev         stave abbreviation (var length, CR terminated)
  178.  
  179. 1     4*(1+o)          offset to end of stave voice
  180. o     stvoice          stave voice        (var length, CR terminated)
  181.  
  182.  
  183. Notes
  184. ~~~~~
  185.      
  186. 2a.   stave data (1)                         (default &08434020)   
  187.      
  188.       bits                                              default
  189.  
  190.       0-3     MIDI channel number - 1 (0-15)                  0
  191.       4-7     number of ARC sound channels allocated (0-8)    2
  192.       8-14    transpose interval + 64                        64
  193.       15      join stave to one above                         0
  194.       16-18   stereo position (0-6)                           3
  195.               (0=full left, 3=centre, 6=full right)
  196.       19-21   0 = normal stave                                0
  197.               1 = solo stave (reduced in height)
  198.               2 = percussion stave 
  199.               3 = sol-fa stave (with barlines etc.)
  200.               4 = blank stave (no barlines or time sigs)
  201.               5 = hidden stave (nothing visible)
  202.       22      bracket stave to one above   [                  1
  203.       23      single bracket                                  0
  204.       24      brace stave to one above   {                    0
  205.       25      if set, pitch map present                       0
  206.       26-27   loudness (0-3 = Silent, Quiet, Normal, SOLO)    2
  207.       28-31   MIDI port number (0-3)                          0
  208.       
  209.       Note that, unlike Rhapsody3 which allocates a unique set of
  210.       internal voice channels to each stave, Rhapsody 4 lumps all
  211.       staves which use the same voice together. It then allocates
  212.       as many channels to that voice as possible using the number
  213.       of sound channels specified as a minimum.
  214.  
  215.  
  216. 2b.   stave data (2)                        (default &00000000)
  217.      
  218.       bits                                              default
  219.  
  220.       0-7     MIDI program number+1 (0-128) 0 = don't send    0
  221.       8-15    bank number LSB+1 (0-128)     0 = don't send    0
  222.       16-23   bank number MSB+1 (0-128)     0 = don't send    0
  223.       24-30   MIDI stereo position (0-127)                   64
  224.       31      not used (must be zero)
  225.  
  226.  
  227. 2c.   stave data (3)                        (default &00600060)
  228.      
  229.       bits                                              default
  230.       0-15     height above centre (in OS units)             96
  231.       16-31    height below centre (in OS units)             96
  232.       
  233. 2d.   pitch map
  234.  
  235.       This is an array of 128 bytes which map one pitch on to another.
  236.       The set is optional depending on bit 25 of stavedata1.
  237.       
  238.  
  239.       The **SY block
  240.       ~~~~~~~~~~~~~~
  241.  
  242.       A **SY block contains data about a musical system - ie a line
  243. of music on a page. Every Rhapsody file has at least one **SY block which
  244. prints the score in linear mode. Other sets of **SY blocks are created
  245. and maintained as required. Each set has a format number. The linear
  246. mode **SY block has format number = 0. The **SY block is the block which
  247. actually prints the staves, the clefs and key signatures. **SY blocks
  248. may contain slot data but this is not recommended as this data will be
  249. lost if that particular format is deleted. Only the first **SY block
  250. of a set in the file contains an FD data block. The linear mode **SY
  251. block does not contain an FD data block.
  252.  
  253.  
  254. 0     &59532A2A        **SY
  255. 4     &ffffllll        flags and length                   see note 3a 
  256. 8     &0000ffww        incl. width required for clef & keysig
  257.  
  258. 12..  data                                       see data codes below
  259.  
  260.  
  261.       System Data                     (7+nstaves+1+nslots words) [SD]
  262.       -----------
  263.  
  264. 0     ll004453         SD block header ll = 7+n (+1+nslots if format>0)
  265. 4     aaaaaaaa         extra OS units required per slot (may be negative)
  266.                        (extra width is not added to either the system
  267.                        slot or the last barline slot)
  268. 8     bbbbbbbb         extra OS units required in the first slot
  269. 12    lhindent         left hand indent (OS units)   
  270. 16    vtindent         vertical indent (OS units from the very top)
  271. 20    selection1       if bit set, print staves 0-31  
  272. 24    selection2       if bit set, print staves 32-50
  273. 28..  bbbbtttt         stave top and bottom spaces for each stave
  274.                        (including those not printed)
  275. 28+4*nstaves%
  276.       0000nnnn         nnnn = number of slots in system inc sys slot
  277.       bbnnffww         slotwidth info for each slot       see note 3b
  278.  
  279.       (The System Data for format 0 does not have any slotwidth info)
  280.  
  281.  
  282.       Format Data                                   (12+n words) [FD]
  283.       -----------
  284.  
  285. 0     ll004446         FD block header ll = 12+n
  286. 4     formatopt        format options etc                 see note 3c
  287. 8     formatsize       format size (points)
  288. 12    selection1       if bit set, select staves 0-31
  289. 16    selection2       if bit set, select staves 32-50
  290. 20    pagebreadth      scaled OS units                    see note 3d
  291. 24    pagelength       scaled OS units
  292. 28    top margin       scaled OS units
  293. 32    bottom margin    scaled OS units
  294. 36    left margin      scaled OS units
  295. 40    right margin     scaled OS units
  296. 44    4*(1+n)          offset to end of format name (o)
  297. 48..  CR terminated format name
  298.  
  299. o     data             other data blocks         see data codes below
  300.  
  301.                        (notably, pedal and octavo codes)
  302.  
  303.  
  304. Notes
  305. ~~~~~
  306.  
  307. 3a.   flags 
  308.  
  309.       bit
  310.      
  311.       16-24   format number  
  312.       31      if set this block starts a new page (and will not be
  313.               removed by reformatting)
  314.  
  315.  
  316. 3b.   bit
  317.  
  318.       0-7     slot width (in OS units)
  319.       8-15    front space (in OS units)
  320.       16-24   number of empty slots to be passed over before printing
  321.               next slot
  322.       25-31   number of bars rest
  323.  
  324.  
  325. 3c.   Format options
  326.  
  327.       Bit
  328.  
  329.       0       0 = portrait              1 = landscape
  330.       1       0 = page numbers off      1 = page numbers on
  331.       2-3     0 = central page numbers
  332.               1 = left page numbers
  333.               2 = right page numbers
  334.               3 = alternate page numbers
  335.       4       0 = top page numbers      1 = bottom page numbers
  336.       5       0 = bar numbers off       1 = bar numbers on
  337.       6       0 = bar numbers at start  1 = bar numbers every 5 bars 
  338.       7       0 = headers off           1 = headers on
  339.       8       0 = no indent             1 = indent first stave
  340.       9       0 = omit                  1 = print short stave names
  341.       10      0 = fixed                 1 = alternate margins
  342.       11    not used (must be zero)
  343.       12-15 packing factor              0-7  = 0 to +35%
  344.                                         8-15 = -40 to -5%
  345.       16-23 initial page number
  346.       24-32 not used (must be zero)
  347.       
  348.       
  349. 3d.   Scaled OS units
  350.  
  351.       At 100% scale, 1mm = 7.09 OS units; 100 OS units = 14.1 mm
  352.       If the format size is 8 (ie 50%), a page length of 297 mm would
  353.       be entered as 297*7.09/0.5 = 4211 scaled OS units
  354.       
  355.       
  356.       
  357.       The **HD block
  358.       ~~~~~~~~~~~~~~
  359.       
  360.       This block contains information about the Titles, headings and
  361. footers. All the data slots are optional.
  362.  
  363. 1     &44482A2A        **HD
  364. 1     &0000llll        length
  365. 1     &00000000        (not used)
  366.  
  367. n     data                                       see data codes below
  368.  
  369.  
  370.       **HD Data Codes
  371.       ~~~~~~~~~~~~~~~
  372.  
  373.       The first word of each code has the following structure
  374.       
  375.       &ll00cccc
  376.       
  377.       ll is the length (in words)
  378.       cc is the code letter pair
  379.      
  380.  
  381.       Title                                        (5+m+n words) [TL]
  382.       -----
  383.  
  384. 1     &llnn4C54                     nn is a code from 0-3 as follows
  385.                                          nn = 0  main title
  386.                                          nn = 1  main sub title
  387.                                          nn = 2  left hand sub title
  388.                                          nn = 3  right hand sub title
  389. 1     &0000xxxx           (as measured from the top left hand corner)
  390.                                           (xxxx=&FFFF means centered) 
  391.                                    (xxxx=&FFFE means right justified)
  392. 1     x point size 
  393. 1     y point size 
  394. 1     4*(1+m)          offset to end of font name 
  395. m     CR terminated font name or style 
  396. 1     4*(1+n)          offset to end of text 
  397. n     CR terminated text
  398.  
  399.       Header                                       (5+m+n words) [HD]
  400.       ------
  401.  
  402. 1     &ll004448
  403. 1     &xxxxyyyy        (not used)
  404. 1     x point size 
  405. 1     y point size
  406. 1     4*(1+m)          offset to end of font name
  407. m     CR terminated font name or style
  408. 1     4*(1+n)          offset to end of text
  409. n     CR terminated text
  410.  
  411.       Footer                                       (5+m+n words) [FT]
  412.       -----
  413.  
  414. 1     &ll005446
  415. 1     &00000000        (not used)        
  416. 1     x point size 
  417. 1     y point size 
  418. 1     4*(1+m)          offset to end of font name
  419. m     CR terminated font name or style
  420. 1     4*(1+n)          offset to end of text
  421. n     CR terminated text
  422.  
  423.       Page Number                                  (5+m+n words) [PN]
  424.       -----------                                
  425.  
  426. 1     &ll004E50
  427. 1     &00000000         not used
  428. 1     x point size 
  429. 1     y point size
  430. 1     4*(1+m)          offset to end of font name
  431. m     CR terminated font name or style
  432. 1     4*(1+n)          offset to end of text
  433. n     CR terminated text (position of page number indicated with <#>)
  434.  
  435.       Signature                                    (5+m+n words) [SG]
  436.       ---------
  437.  
  438.       This is positioned at the very end of the score
  439.  
  440. 1     &ll004753
  441. 1     &00000000         not used
  442. 1     x point size 
  443. 1     y point size
  444. 1     4*(1+m)          offset to end of font name
  445. m     CR terminated font name or style
  446. 1     4*(1+n)          offset to end of text
  447. n     CR terminated text 
  448.  
  449.  
  450.  
  451.       The **SL block
  452.       ~~~~~~~~~~~~~~
  453.  
  454. 0     &4C532A2A        **SL
  455. 4     &ffffllll        flags and length                   see note 4a
  456. 8     slotwidth        slot width                         see note 4b
  457.  
  458. n     data                                       see data codes below
  459.  
  460.  
  461. Notes
  462. ~~~~~   
  463.      
  464. 4a.   flags
  465.       
  466.       bits
  467.  
  468.       16-18     0 = no barline
  469.                 1 = ordinary barline
  470.                 2 = 1st time bar
  471.                 3 = 2nd time bar
  472.                 4 = rehearsal letter
  473.       19        blank stave
  474.       20-28     not used (must be zero)
  475.       29        slot contains info item (CL, KS, TS, GD, OB)
  476.       30        slot contains long item (TX, VC, HP, PM, OC, PD, NC(tied))
  477.       31        barline
  478.  
  479.  
  480. 4b.   slotwidth/time
  481.  
  482. 1     &ttttffww
  483.  
  484.       Each slot has an imaginary line down it called the note line on
  485. which the notes are placed. The front space is the distance between
  486. the note line and the front of the slot.
  487.  
  488.       ww   is the total width (OS units) (max 255)
  489.       ff   is the front space (OS units) (max 255)
  490.       tttt is the time from the start of the bar in microbeats
  491.            (1 crotchet = 96 microbeats)
  492.       
  493.  
  494. Data codes
  495. ~~~~~~~~~~
  496.  
  497.       The first word of each code has the following structure
  498.       
  499.       &llsscccc
  500.       
  501.       ll is the length (in words)
  502.       ss is the stave number (0 = all staves))
  503.       cc is the code letter pair
  504.      
  505.  
  506.       Volume                                           (3 words) [VO]
  507.       ------
  508.  
  509. 0     &0Css4F56
  510. 4     target volume (0-127). The 'normal' volume is 100 giving some
  511.       room for crescendo. 
  512. 8     number of beats (0-255). This is the number of (crotchet) beats
  513.       over which the crescendo or decrescendo is to take place.
  514.  
  515.      
  516.       Tempo                                            (3 words) [TP]
  517.       -----
  518.  
  519. 0     &03005054
  520. 4     target tempo (0-512). All tempos are in crotchets per minute
  521. 8     number of beats (0-255). This is the number of (crotchet) beats
  522.       over which the tempo change is to take place.    
  523.  
  524.      
  525.       Expression                                       (3 words) [EX]
  526.       ----------
  527.  
  528. 0     &03004558
  529. 4     Depth (-100 - 100)
  530. 8     not used (must be zero)
  531.  
  532.      
  533.       MIDI event                                     (4+n words) [MD]
  534.       -----
  535.  
  536. 0     &nn00444D
  537. 4     start data.
  538. 8     end data.
  539. 12    number of microbeats. This is the number of microbeats over
  540.       which the data is to be transmitted. (If this word is zero, the
  541.       end data should be equal to the start data.)
  542. 16    MIDI data (CR terminated)
  543.  
  544.          MIDI data is held as a text string in hex separated by commas.
  545.       The symbol 'c' is substituted during transmission by the channel
  546.       number. The symbol 'xx' is substitued by a 7 bit data value. The
  547.       symbol 'll,hh' is substitued by a 14 bit data value. Graded
  548.       changes are sent every microbeat or whenever the value changes.
  549.  
  550.  
  551.       Clef                                             (2 words) [CL]
  552.       ----
  553.  
  554. 0     &02ss4C43
  555. 4     bits 0-3     clef number
  556.       bits 8-11    previous clef number
  557.                    clef number : position of middle C on stave
  558.                    0 = no clef printed (default to treble): 26
  559.                    1 = treble                             : 26
  560.                    2 = alto                               : 32
  561.                    3 = vocal tenor                        : 33
  562.                    4 = instrumental tenor                 : 34
  563.                    5 = bass                               : 38
  564.                    6 = percussion                         : 26
  565.                    7 = soprano clef                       : 28
  566.                    8 = mezzo soprano clef                 : 30
  567.                    9 = baritone clef                      : 36
  568.  
  569.  
  570.       Key Signature                                    (2 words) [KS]
  571.       -------------
  572.       
  573. 0     &02ss534B
  574. 4     bits 0-7     key number
  575.       bits 8-15    previous key number
  576.                    0    = no key signature (defaults to C major)
  577.                    1-7  = flats, ...
  578.                    8    = no flats or sharps (ie C major), ..
  579.                    9-15 = sharps
  580.  
  581.  
  582.       Time signature                                   (2 words) [TS]
  583.       --------------
  584.  
  585. 0     &02005354
  586. 4     &0000bbnn
  587.       nn = number of beats in a bar
  588.       bb = beat type: 8=quaver, 4=crotchet, 2=minim etc.
  589.  
  590.  
  591.       Other barlines                                   (2 words) [OB]
  592.       --------------
  593.      
  594. 0     &0200424F
  595. 4     bit 0-3 1=half barline
  596.               2=double bar
  597.               3=endbar
  598.               4=start repeat
  599.               5=end repeat
  600.               6=double repeat
  601.               7=dashed bar line
  602.               8=caesura
  603.                  
  604.  
  605.       Global directives                                (3 words) [GD]
  606.       --------------
  607.      
  608. 0     &03004447
  609. 4     &xxxxyyyy
  610. 8     bit 4-7 0  = no special sign
  611.               1  = no special sign
  612.               2  = segno sign
  613.               3  = coda wheel
  614.               4  = da capo
  615.               5  = da capo al fine
  616.               6  = dal segno
  617.               7  = dal segno al fine
  618.               8  = fine
  619.               9  = coda
  620.               10 = suppress triplet printing from here
  621.               11 = reinstate triplet printing
  622.               12 = suppress accent printing from here
  623.               13 = reinstate accent printing
  624.  
  625.  
  626.       Definitions                                     (15 words) [TD]
  627.       -----------
  628.  
  629. 0     &0D004454
  630. 4     &0000llww   % length/weight for staccato notes
  631. 8     &0000llww   % length/weight for spiccato notes
  632. 12    &0000llww   % length/weight for tenuto notes
  633. 16    &0000llww   % length/weight for accented notes
  634. 20    &0000llww   % length/weight for stressed notes
  635. 24    &0000llww   % length/weight for sforzando notes
  636. 28    &00xxnnss (x8)
  637.       ss  bit 0   if set, upper interval is tone, else semi-tone
  638.               1   if set, lower interval is tone, else semi-tone
  639.               2-3 0 = trill begins on middle note
  640.                   1 = trill begins on upper note
  641.                   2 = trill begins on lower note
  642.               4   if set, trill has a turn at the start
  643.               5   if set, trill has a turn at the end
  644.               6-7 0 = trill has no shakes (ie is a grace note or turn)
  645.                   1 = trill has one shake
  646.                   2 = trill has two shakes
  647.                   3 = trill has continuous shakes
  648.       nn    number of notes per crotchet (1-31)
  649.             nn = 0 means fit as many notes as is reasonable
  650.       xx  bit 0-1 0 = normal upper note
  651.                   1 = upper note sharp
  652.                   2 = upper note flat
  653.           bit 2-3 0 = normal lower note
  654.                   1 = lower note sharp
  655.                   2 = lower note flat
  656.           bit 7   if set, ignore bits 0 and 1 of ss and use xx instead       
  657.  
  658.  
  659.  
  660.       Text                                           (3+n words) [TX]
  661.       ----
  662.  
  663. 0     &llss5854
  664. 4     xxxxyyyy
  665. 8     ffffffff    If bit 31 set, text is autospaced
  666. 12    text (CR terminated)
  667.  
  668.  
  669.  
  670.       Channel voice change                           (3+n words) [VC]
  671.       --------------------
  672.       
  673. 0     &llss4356 
  674. 4     Not used
  675. 8     MIDI program/bank change number                
  676.       bit 0-7     MIDI program number+1 (0-128)   0 = don't send   
  677.       bit 8-15    bank number LSB+1               0 = don't send 
  678.       bit 16-23   bank number MSB+1               0 = don't send 
  679.       bit 24-32   not used (must be zero)              
  680. 12    CR terminated string containing Archimedes voice name
  681.  
  682.      
  683.       Dynamics                                         (3 words) [DN]
  684.       --------
  685.  
  686. 0     &03ss4E44
  687. 4     &xxxxyyyy                                            see note 5
  688. 8     bit 0-3  0=silent, 1=ppp,  2=ppp+,  3=pp
  689.                4=pp+,    5=p,    6=p+,    7=mp
  690.                8=mp+,    9=mf,  10=mf+,  11=f
  691.                12=f+,   13=ff,  14=ff+,  15=fff
  692.       bit 7    if set, don't print 
  693.  
  694.  
  695.       Directives                                       (3 words) [DR]
  696.       ----------
  697.      
  698. 0     &03ss5244
  699. 4     &xxxxyyyy      see note 5
  700. 8     0 = cresc.    1 = decresc.    2 = dim.
  701.       4 = accel.    5 = rit.        6 = rall.
  702.       8 = pizz.     9 = arco
  703.  
  704.      
  705.       Pedal                                            (3 words) [PD]
  706.       -----
  707.       
  708. 0     &03ss4450
  709. 4     &0000yyyy      (see note 5)
  710. 8     bit 0   : if set, pedal on
  711.       bit 1   : if set, pedal off
  712.       
  713.       (Note that the pedal may be set off and on again in the same slot)
  714.       
  715.       
  716.       Octavo                                          (3 words) [OC]
  717.       ------
  718.       
  719. 0     &03ss434F
  720. 4     &xxxxyyyy      (see note 5)
  721. 8     bit 0        0=start symbol, 1=end symbol
  722.       bit 1        0=print,        1=don't print symbol
  723.       bits 24-31   transpose interval (signed)
  724.       
  725.       NB Octavo start codes should be placed before any note codes but
  726.       octavo end codes should be placed at the end of the slot
  727.       
  728.       NB Octavo end codes ignore the transpose interval and reset the
  729.       transpose interval to the previous value
  730.  
  731.  
  732.       Bowing marks                                     (3 words) [BM]
  733.       ------------
  734.      
  735. 0     &03ss4D42
  736. 4     &xxxxyyyy      see note 5
  737. 8     bit 0    0 = up bow            1 = down bow
  738.  
  739.      
  740.       Pause symbols                                    (3 words) [GP]
  741.       -------------
  742.  
  743. 0     &03ss5047
  744. 4     &xxxxyyyy      (see note 5)     
  745. 8     bits 0-1  0 = pause
  746.                 1 = inverted pause
  747.                 2 = breath
  748.  
  749.      
  750.       Hairpin start                                    (4 words) [HP]
  751.       -------------
  752.      
  753. 0     &04ss5048
  754. 4     id number
  755. 8     &xxxxyyyy     coords of start (see note 5)
  756. 12                  0 = crescendo
  757.                     1 = decrescendo
  758.                     2 = solid line
  759.                     3 = dotted line
  760.  
  761.  
  762.       Hairpin end                                      (4 words) [HQ]
  763.       -------------
  764.      
  765. 0     &04ss5148
  766. 4     id number
  767. 8     &xxxxyyyy      coords of end (see note 5)
  768. 12    &00000000      not used
  769.  
  770.      
  771.       Phrase mark start                                (4 words) [PM]
  772.       -----------------
  773.      
  774. 0     &04ss4D50  
  775. 4     &nnnnnnnn      id number
  776. 8     &xxxxyyyy      coords of start (see note 5)
  777. 12    &xxxxyyyy      coords of first cp rel. to start (see note 5)
  778.  
  779.      
  780.       Phrase mark end                                  (4 words) [PN]
  781.       ---------------
  782.      
  783. 0     &04ss4E50  
  784. 4     &nnnnnnnn      id number
  785. 8     &xxxxyyyy      coords of end (see note 5)
  786. 12    &xxxxyyyy      coords of second cp rel. to end (see note 5)
  787.  
  788.  
  789.       Square bracket                                   (3 words) [SB]
  790.       --------------
  791.       
  792. 0     &03ss4253
  793. 4     &xxxxyyyy      coords of centre (see note 5)
  794.       bits 0-7       length (os units)
  795.       bit 31         if set, right bracket
  796.  
  797.  
  798.       Guitar chords                                    (6 words) [GC]
  799.       -------------
  800.  
  801. 0     &06ss4347
  802. 4     &xxxxyyyy      (see note 5)
  803. 8     bits 0-3       position on Efret (0 = don't play)
  804.       bits 4-7       position on Afret (0 = don't play)
  805.       bits 8-11      position on Dfret (0 = don't play)
  806.       bits 12-15     position on Gfret (0 = don't play)
  807.       bits 16-19     position on Bfret (0 = don't play)
  808.       bits 20-23     position on Efret (0 = don't play)
  809. 12    Name (CR terminated) (max 11 chars)
  810.              
  811.      
  812.       Repeat bar sign (%)                              (2 words) [RB]
  813.       ---------------
  814.      
  815. 0     &03ss4252
  816. 4     not used (must be zero)
  817.                                          
  818.  
  819.       Rest                                             (3 words) [RS]
  820.       ----
  821.  
  822. 0     &03ss5352
  823. 4     rest length    (see note length below)
  824. 8     bits 0-5   position on stave (0-63)
  825.       bit  23    if set, rest is part of a nplet and does not need
  826.                  npleting                                         [*]
  827.  
  828.  
  829.       Note cluster                                 (4+n+g words) [NC]
  830.       ------------
  831.  
  832. 0     &llss434E
  833. 4     note length
  834.       bit 0-2   0 = hemi-demi-semi-quaver
  835.                 1 = demi-semi-quaver
  836.                 2 = semi-quaver
  837.                 3 = quaver
  838.                 4 = crotchet
  839.                 5 = minim
  840.                 6 = semi-breve
  841.                 7 = breve
  842.           3-4   0 = no dots
  843.                 1 = single dot
  844.                 2 = double dot
  845.                 3 = triple dot
  846.           5     if set, then nplet
  847.           6     if set, note is the start of an nplet             [*]
  848.           7     not used (must be zero)
  849.           8-11  aplet (eg for standard triplet aplet=3)
  850.           12-15 bplet (eg for standard triplet bplet=2)
  851.           16-31 not used (some old scores may have some bits set)
  852. 8     note flags
  853.       bit 0-4   0 = normal
  854.                 1 = staccato
  855.                 2 = spiccato
  856.                 3 = tenuto
  857.                 4 = accented
  858.                 5 = stressed
  859.                 6 = sforzando
  860.                 7 = fortepiano
  861.                 8 = silent
  862.                11 = glissando
  863.                12 = quaver tremolo
  864.                13 = semi-quaver tremolo
  865.                14 = demi-semi-quaver tremolo
  866.                15 = twin tremolo
  867.                16 = trill 1
  868.                17 = trill 2
  869.                18 = upper mordent
  870.                19 = baroque upper mordent
  871.                20 = lower mordent
  872.                21 = baroque lower mordent
  873.                22 = turn
  874.                23 = inverted turn
  875.           5     if set, harmonic
  876.           6,7   0 = normal
  877.                 1 = force beam
  878.                 2 = break beam
  879.                 3 = half beam (not implemented)
  880.           8-11  0 = not spread
  881.                 1-15 spread speed
  882.           12    if set, play top to bottom
  883.           13    if set, play on the beat
  884.           14    if set, print arrow
  885.           15    if set, note is small (cue part)
  886.           16    if set, note has a downstalk
  887.           17    if set, note is tied
  888.           18    if set, note is slurred
  889.           19    if set, note has no stem
  890.           20    if set, note is tied to a previous note and does
  891.                 not need playing                                  [*]
  892.           21    if set, note is part of a beam and does not need
  893.                 beaming                                           [*]
  894.           22    if set, note is slurred to a previous note and does
  895.                 not need slurring                                 [*]
  896.           23    if set, note is part of a nplet and does not need
  897.                 npleting                                          [*]
  898.           24-31 actual stalk length (OS units div 4) taking into
  899.                 account beams (not changed for reduced staves)    [*]
  900. 12    note flags2
  901.       bit 0-3   number of notes (n)
  902.       bit 4-7   number of grace notes (g)
  903.       bit 8     0 = acciaccatura,           1 = appoggiatura
  904.           9     0 = chord,                  1 = separated
  905.           10    0 = played before the beat, 1 = played on the beat
  906.           11    0 = unslurred,              1 = slurred
  907.           12    if set beam to note on stave above
  908.           13    if set beam to note on stave below
  909.           14-16 micro adjust accents (OS units DIV 4)
  910.           17-18 not used (must be zero)
  911.           19    if set, alternative cluster
  912.           20    if set, slur is printed the 'wrong' way up
  913.           21    if set, cluster contains some reversed notes      [*]
  914.           22-25 positive cluster offset (OS units DIV 4)
  915.           26-29 negative offset of grace cluster (OS units DIV 4)
  916. 16    lowest note attributes ... highest note attributes
  917.       bit 0-5   position on stave (0-63)
  918.           6     if set, tie is printed the 'wrong' way up
  919.           7     if set, note is printed on 'wrong' side           [*]
  920.           8-10  0 = no accidental
  921.                 1 = sharp
  922.                 2 = flat
  923.                 3 = natural
  924.                 4 = double sharp
  925.                 5 = double flat
  926.                 6 = natural sharp
  927.                 7 = natural flat
  928.           11    bracketed accidental
  929.           12-15 negative offset of accidental (OS units DIV 4)
  930.           16,17 not used (must be zero)
  931.           18-20 0 = normal
  932.                 1 = small
  933.                 2 = cross
  934.                 3 = diamond
  935.                 4 = open diamond
  936.                 5 = headless
  937.           21-31 not used (must be zero)
  938. 16+4*n    0-5   position on stave (0-63: 32 = centre line on stave)
  939.           6,7   not used (must be zero)
  940.           8-10  0 = no accidental
  941.                 1 = sharp
  942.                 2 = flat
  943.                 3 = natural
  944.                 4 = double sharp
  945.                 5 = double flat
  946.                 6 = natural sharp
  947.                 7 = natural flat
  948. 16+4*n+4*g
  949.  
  950.  
  951. Notes 
  952. ~~~~~
  953.  
  954. [*]   Flags marked with a * are set by Rhapsody automatically and can
  955. be ignored (or set to zero) by other programs
  956.  
  957.  
  958. 5.    Graphics coordinates
  959.  
  960.       Many data items have associated coordinates. These are specified
  961. in a single word as two signed 16 bit integers
  962.  
  963.       &xxxxyyyy
  964.        
  965.       xxxx x coord offset
  966.       yyyy y coord offset
  967.       
  968.       offsets are measured in OS units from the point where the note
  969. line intersects the stave line with the exception of the left square
  970. bracket where the offset is measured from the front of the slot
  971.  
  972.  
  973. Notes on creating a simple R4 score
  974. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  975.  
  976. The first 4 words should be
  977.       
  978.       &50414852    RHAP
  979.       &59444F53    SODY
  980.       &30302E34    4.00 
  981.       &0000000D    <CR>
  982.       
  983. The **SC block should look like this
  984.  
  985.       &43532A2A    **SC
  986.       &40000054    bit 30 must be set, bit 31 must be unset so that R4 will
  987.                    recalculate all slot widths and flags on loading
  988.       &00000028    offset to font list
  989.       &000000nn    nn = number of staves
  990.       &00000077    play options
  991.       &00000064    playing speed
  992.       &00002509    midibeat options
  993.       &00000030    print options
  994.       &0000llll    llll - score length in bytes
  995.       &00000000    can be ignored if bit 31 unset above
  996.       &40800101    midibeat pc data
  997.       &01010100    initial bar and page numbers
  998.       &0000000C    offset
  999.       &6E697254    body font 1 (Trinity)
  1000.       &0D797469    
  1001.       &00000010    offset
  1002.       &656D6F48    body font 2 (Homerton)
  1003.       &6E6F7472    
  1004.       &0000000D
  1005.       &00000008    offset
  1006.       &0D3EA93C    Copyright notice (<⌐>)
  1007.       
  1008. The there should be a number of stave slots eg:
  1009.  
  1010.       &54532A2A    **ST
  1011.       &0000003C    length of slot
  1012.       &00000010    offset
  1013.       &08434020    stavedata1
  1014.       &40000000    stavedata2
  1015.       &00600060    stavedata3
  1016.       &00000008    offset
  1017.       &0000000D    stave name (blank)
  1018.       &00000008    offset
  1019.       &0000000D    stave abbreviation (blank)
  1020.       &00000014    offset
  1021.       &69727453    stave voice
  1022.       &694C676E
  1023.       &6F532D62
  1024.       &000D7466
  1025.  
  1026.  
  1027. There follows a system slot:
  1028.   
  1029.       &59532A2A    **SY
  1030.       &0000002C    length (&28 + 4*number of staves)
  1031.       &00000010    slot width
  1032.       &08004453    SD code (length 8)
  1033.       &00000000    extra OS units
  1034.       &00000000    extra OS units
  1035.       &00000190    left hand indent
  1036.       &FFFFFFB0    vertical indent (negative)
  1037.       &FFFFFFFF    stave selection (all)
  1038.       &FFFFFFFF    stave selection
  1039.       &00600060    stave heights (repeated as necessary)
  1040.          ...            "
  1041.          
  1042.  
  1043. and a blank header slot:
  1044.   
  1045.   
  1046.       &44482A2A    **HD
  1047.       &0000000C    length
  1048.       &00000000    (not used)
  1049.       
  1050.       
  1051. Now the data slots of which this is an example:
  1052.   
  1053.       &4C532A2A    **SL
  1054.       &00000014    flags = 0, length &14
  1055.       &00000000    slotwidth (will be calculated by R4 on loading if
  1056.                    bit 31 above is unset)
  1057.       &02014C43    clef code CL, stave 1, length 2 words
  1058.       &00000001    treble clef
  1059.       
  1060.  
  1061. The end of the file is terminated with      
  1062.       
  1063.       &2A2A2A2A    ****
  1064.       
  1065.  
  1066. Other points
  1067. ~~~~~~~~~~~~
  1068.  
  1069. If bit 31 of the score flags is unset, R4 will inspect every slot in
  1070. the score on loading and reset certain flags etc. These include
  1071.  
  1072.       the score flags (bits 29-31)
  1073.       bits 29 and 30 of the slot flags
  1074.       all slot width and timing information
  1075.       the 'previous clef' number
  1076.       the 'previous key signature' number
  1077.            
  1078.  
  1079.  
  1080. Appendix
  1081. ~~~~~~~~
  1082.  
  1083. Preferences are held in a small data file containing the following
  1084. BASIC style data items
  1085.  
  1086. INT     display options bit 0     beams
  1087.                         bit 1     bar numbers
  1088.                         bit 2     spots
  1089.                         bit 3     timings
  1090.                         bit 4     extended cursor
  1091. INT     colours1        bit 0-3   cursor body
  1092.                         bit 4-7   cursor edge
  1093.                         bit 8-11  step capture
  1094.                         bit 12-15 control spots
  1095.                         bit 16-19 size handles
  1096. INT     colours2        bit 0-3   speed changes
  1097.                         bit 4-7   volume changes
  1098.                         bit 8-11  timings
  1099.                         bit 12-15 bar numbers
  1100.                         bit 16-19 hidden dynamics
  1101. INT     autosave        bit 0-7   auto save time (0-255 minutes)
  1102.                         bit 8     autosave on
  1103.                         bit 9     prompt before saving
  1104.                         bit 10    perform autochecking
  1105.                         bit 11    too many
  1106.                         bit 12    too few
  1107.                         bit 13    alignment
  1108. INT     autonotes       bit 0-7   note used for capturing rests
  1109.                         bit 31    use note to capture rests
  1110. INT     miscopt         bit 0     sound notes while dragging
  1111.                         bit 1     sound notes on insertion
  1112.                         bit 2     automatic alignment on insertion
  1113.                         bit 3     show tip of the day
  1114. INT     dynamicsmap     bit 0-3   1  level (ppp)
  1115.                         bit 4-7   3  level (pp)
  1116.                         bit 8-11  5  level (p)
  1117.                         bit 12-15 7  level (mp)
  1118.                         bit 16-19 9  level (mf)
  1119.                         bit 20-23 11 level (f)
  1120.                         bit 24-27 13 level (ff)
  1121.                         bit 28-31 15 level (fff)
  1122. INT     level           1 = basic
  1123.                         2 = intermediate
  1124.                         3 = advanced        
  1125. INT     printopt
  1126. INT     initial numbers
  1127. INT     recordopt
  1128. INT     playopt
  1129. INT     playspeed
  1130. INT     midibeat
  1131. INT     midibeatdata
  1132. INT     stavedata1
  1133. INT     stavedata2
  1134. INT     stavedata3
  1135. STRING  stavename$
  1136. STRING  staveabbrev
  1137. STRING  stavevoice
  1138. INT     pagetype
  1139. INT     format options
  1140. INT     format size
  1141. INT     top margin (OS units)
  1142. INT     bottom margin (OS units)
  1143. INT     left margin (OS units)
  1144. INT     right margin (OS units)
  1145. INT     save box shortcut (0=F3, 1=^ïF3, 2=F11)
  1146.  
  1147.  
  1148.  
  1149.  
  1150.         R4Player messages
  1151.         ~~~~~~~~~~~~~~~~~
  1152.  
  1153.  
  1154.         R4Player is a Wimp application which has no windows or menus.
  1155. Its function is to play Rhapsody4 files or MIDIfiles and to generate
  1156. MIDI files on request from another application. It responds to the
  1157. following messages with the associated parameter blocks described.
  1158.  
  1159.         Normally, applications will issue an 'Are you here' message.
  1160. If this message is returned empty, they should start up R4Player from
  1161. their own resources. R4Player keeps track of which applications have
  1162. requested its services and when all such applications have died, it
  1163. will kill itself.
  1164.  
  1165.  
  1166.         PLAY% &506C0 (plays a Rhapsody4 or MIDI file)
  1167.         
  1168.         20    pointer to start of score
  1169.         24    pointer to play position
  1170.         28    dynamics map
  1171.         32    recording flag (TRUE during real-time capture)
  1172.         
  1173.         Note, in the case of Rhapsody4 files, the play position
  1174. pointer does not have to point to a slot, R4Player scans ahead to find
  1175. a slot to play. In the case of MIDI files, only the start pointer is
  1176. relevant.
  1177.  
  1178.         
  1179.         MIDI% &506C1 (generates a MIDI file)
  1180.         
  1181.         20    pointer to start of score
  1182.         24    pointer to start of output block
  1183.         28    dynamics map
  1184.         32    MIDI format (0 or 1)
  1185.         
  1186.         
  1187.         PAUS% &506C2 (Pauses playing temporarily)
  1188.         
  1189.         
  1190.         SPED% &506C3 (Changes the tempo)
  1191.         
  1192.         20    Speed (100 = normal speed)
  1193.         
  1194.         
  1195.         HALT% &506C4 (stops play immediately)
  1196.         
  1197.         No data required
  1198.         
  1199.         
  1200.         R4PL% &506C5 (are you here?)
  1201.         
  1202.         This message is broadcast by any application interested in
  1203. using R4Player. If present R4Player notes the task handle of the
  1204. application and responds with a HELO message.
  1205.  
  1206.         
  1207.         PMSF% &506C6 (generates a PMS file)
  1208.         
  1209.         20    pointer to start of score
  1210.         24    pointer to start of output block
  1211.                     
  1212.         
  1213.         SDAT% &506C7  (sends stave data)
  1214.         
  1215.         20    stave data for all staves (1 word each)
  1216.  
  1217.  
  1218.         R4Player issues the following messages:
  1219.            
  1220.          
  1221.         MESS% &506D0  
  1222.         
  1223.         20    message text
  1224.          
  1225.          
  1226.         POSN% &506D1 (Sends position)                                
  1227.                         
  1228.         20    x coordinate (R4 files only)
  1229.         24    % of file played
  1230.          
  1231.         This is used by Rhapsody4 to scroll the window during play.
  1232.  
  1233.  
  1234.         STPD% &506D2 (Play stopped)
  1235.           
  1236.         No data required
  1237.           
  1238.         This is issued if, for any reason, R4Player has to stop
  1239. playing.
  1240.  
  1241.  
  1242.         DONE% &506D3 (MIDI file created)
  1243.           
  1244.         20    start of MIDI file (inclusive)
  1245.         24    end of MIDI file (exclusive)
  1246.           
  1247.         This is issued when a R4Player has finished creating a MIDI file.
  1248.          
  1249.          
  1250.         HELO% &506D4
  1251.         
  1252.         No data required
  1253.          
  1254.         This message is issued in response to an 'are you here?'
  1255. message. It is also issued when R4Player is started up to let
  1256. applications know that it has arrived.
  1257.  
  1258.  
  1259.         PMSD% &506D5 (PMS file created)
  1260.           
  1261.         20    start of PMS file (inclusive)
  1262.         24    end of PMS file (exclusive)
  1263.           
  1264.         This is issued when a R4Player has finished creating a MIDI file.
  1265.         
  1266.         
  1267.         Other messages:
  1268.           
  1269.         &506E0 (Midi string)
  1270.  
  1271.         20    midi string
  1272.         
  1273.         
  1274.  
  1275.         R4render
  1276.         ~~~~~~~~
  1277.           
  1278.         R4render is a relocatable module which will render a
  1279. Rhapsody4 score or produce a drawfile. It respondes to a single star
  1280. command which has a single parameter:
  1281.   
  1282.         *R4render <parameter block>
  1283.           
  1284.         The parameter is a pointer to a 24 word parameter block
  1285. defined as follows
  1286.  
  1287.         block%!0     pointer to base of score
  1288.         block%!4     view scale (%)
  1289.         block%!8     format number
  1290.         block%!12    page number (first page is zero)
  1291.         block%!16    x origin
  1292.         block%!20    y origin
  1293.         block%!24    pointer to cursor
  1294.         block%!28    cursor stave
  1295.         block%!32    cursor position (-31 to 31)
  1296.         block%!36    min x coord of graphics window
  1297.         block%!40    min y coord of graphics window
  1298.         block%!44    max x coord of graphics window
  1299.         block%!48    max y coord of graphics window
  1300.         block%!52    0 = printing to screen
  1301.                      1 = printing hardcopy
  1302.                      2 = create drawfile
  1303.         block%!56    1,2 = normal cursor
  1304.                      3 = drop mode style
  1305.                      4 = step capture style (both tails)
  1306.                      5 = step capture style (up tails)
  1307.                      6 = step capture style (down tails)
  1308.         block%!60    block start pointer
  1309.         block%!64    block end pointer
  1310.         block%!68    block first stave
  1311.         block%!72    block last stave
  1312.         block%!76    preferences
  1313.         block%!80    colours 1
  1314.         block%!84    colours 2
  1315.         block%!88    pointer to start of drawfile
  1316.         block%!92    max size of drawfile
  1317.      
  1318.      
  1319.                                                         (c) J.O.Linton
  1320.                                                            09 May 1998     
  1321.